const dealUrl = {
  parseQuery(url) {
    const index = url.indexOf('?');
    if (index < 0) {
      return {};
    }

    let str = url.substring(index + 1);
    const index2 = str.indexOf('#');
    if (index2 > -1) {
      str = str.substring(0, index2);
    }
    const uriParam = {};
    const tmp = str.split('&');
    let tmp2;
    for (let i = 0; i < tmp.length; i++) {
      tmp2 = tmp[i].split('=');
      uriParam[tmp2[0]] = decodeURIComponent(tmp2[1]) || '';
    }
    return uriParam;
  },
  uriQuery(k) {
    const uriParam = this.parseQuery(location.href);
    return uriParam[k] || '';
  },
};

export default dealUrl;
